// src/models/userModel.js
import {useState} from 'react';
import {getIsLogin, IS_LOGIN_KEY, setIsLogin} from "@/store/store";

export default function userModel() {
    const [isLogin,setLogin] = useState(getIsLogin(IS_LOGIN_KEY.IS_LOGIN));

    const login = () => {
        setLogin("true");
        setIsLogin(IS_LOGIN_KEY.IS_LOGIN, "true")
    };

    const logout = () => {
        setLogin("false");
        setIsLogin(IS_LOGIN_KEY.IS_LOGIN, "false")
    };

    return {
        isLogin,
        login,
        logout,
    };
}